#ifndef __CHARSETS_PLUGIN_H__
#define __CHARSETS_PLUGIN_H__

class QTreeWidget;
class QTreeWidgetItem;
	
#include <QtCore>
#include <QtCore/QObject>

#include <juffed/JuffPlugin.h>

class CharsetsPlugin : public QObject, public JuffPlugin {
Q_OBJECT
Q_INTERFACES(JuffPlugin)
public:
	CharsetsPlugin();
	virtual ~CharsetsPlugin();

	//	info
	virtual QString name() const;
	virtual QString description() const;
	virtual QString targetEngine() const;

	virtual QWidget* settingsPage() const;
	virtual Juff::ActionList mainMenuActions(Juff::MenuID) const;

	virtual void saveSettings();

protected slots:
	void actionTriggered();
	void onItemChanged(QTreeWidgetItem*, int);

private:
	typedef QPair<QString, QString> Enc;
	typedef QList<Enc> EncList;
	QHash<QString, EncList> encodings_;

	void checkTopLevelItem(QTreeWidgetItem*);

	void initEncodings();

	QAction* action_;
	QTreeWidget* w_;
};

#endif
